package com.golxen.framework.common.server.game;

import com.golxen.framework.db.CheckSqlConnectionTask;
import com.golxen.framework.executor.ThreadPlugin;
import com.golxen.framework.manager.MgrDataSaveTask;
import com.golxen.framework.netty.session.agent.CrossConnectCheckTask;
import com.golxen.framework.netty.session.agent.CrossNewServerConnCheckTask;
import com.golxen.framework.timers.TimerPlugin;

import java.util.concurrent.TimeUnit;

public class GameAppPlugin {
    static GameAppPlugin instance=null;

    public static void start(){
        if (instance!=null){
            return;
        }
        instance=new GameAppPlugin();

        TimerPlugin.registTimer(DailyTask.class,TimerPlugin.getNextResetTaskExecuteTime()+2,60*60*24, TimeUnit.SECONDS);
        TimerPlugin.registTimer(MgrDataSaveTask.class,0,3,TimeUnit.SECONDS,ThreadPlugin.getCpu());
        TimerPlugin.registTimer(CheckSqlConnectionTask.class,5, 5, TimeUnit.SECONDS);

        TimerPlugin.registTimer(CrossConnectCheckTask.class, 10, 5, TimeUnit.SECONDS);
        TimerPlugin.registTimer(CrossNewServerConnCheckTask.class, 60, 120, TimeUnit.SECONDS);
    }
}
